import request from '../utils/request'

// 轮播图请求
export const getSwiper = () => request.get('/home/swiperdata')
// 导航数据请求
export const getNav = () => request.get('/home/catitems')
// 楼层数据
export const getFloor = () => request.get('/home/floordata')

// 获取分类列表
export const getCate = () => request.get('/categories')

// 获取商品列表
export const getGoodsList = query => request.get('/goods/search', query)
// 商品详情
export const getGoodsDetail = query => request.get('/goods/detail', query)

// 微信用户登录 -- 更换为 getToken，此接口服务器有误
export const wxLogin = query => request.post('/users/wxlogin', query)

// 商品搜索建议
export const qSearch = query => request.get('/goods/qsearch', query)

// 换取token的接口
export const getToken = obj => request.getToken("/users/wxlogin", obj)

//----------- 以下接口请求都要授权登录后才能访问 -----------
// 创建订单
export const orderCreate = obj => request.auth("/my/orders/create", obj)
// 支付订单
export const orderPay = obj => request.auth("/my/orders/req_unifiedorder", obj)
// 更新支付状态
export const orderChk = obj => request.auth("/my/orders/chkOrder", obj)
// 查询订单 get
export const orderAll = obj => request.auth.get("/my/orders/all", obj)
